// JavaScript Document
function 	doRegUser (obj,/*form XmlNode*/frmobj){
	  $(obj).disabled = true;
	  try{
		  var sQuery = Form.serialize(frmobj);
		  if(PG.doCmd('RegUser',sQuery,0)==1){
			  chkLogin('UserName','PWD','vCode','/my/default.html');
		  }
	  }catch(e){
		  alert(e);
	  }
	  $(obj).disabled = false;
}
function chkLogin(/*String|Object*/userId,/*String|Object*/pwdId,/*String*/vCode,/*String*/toUrl){
	if(!toUrl) toUrl= '/default.html';
	if(!$(userId)||!$(pwdId)){ alert('对象不存在');return};
	var _alert = _window.Open('<img src="/images/default/loading.gif"/>','系统登录中,请稍候...','ismodal=1,width=240,class=VISTA,resize=no');
	var _isLogin = false;
	userId = $(userId).value;
	pwdId = $(pwdId).value;
	vCode = $(vCode).value;
	if(userId.length<3||pwdId.length<3){
		alert('对不起！用户名及密码至少3位！！');
	}else{
	var q= 'txtUserName='+userId+'&txtPassword='+pwdId+'&vCode='+vCode;
	new Ajax.Request('/httpchklogin.html',
									{
										asynchronous:false,
										parameters: q ,
										method: 'post',
										onComplete:function(r){
											var text = r.responseText;
											
											if(text.split(",")[0]==0){
												_isLogin = true;
												if(toUrl==null){
													location.href=document.referer?document.referer:'/my/default.html';
												}else location.href=toUrl;
												_alert = _window.Open('<img src="/images/default/loading.gif"/>','登录成功！转向中,请稍候...','ismodal=1,width=240,class=VISTA,resize=no');
											}else if(text.split(",")[0]==103){
												if($('vCodeLine')) Element.show('vCodeLine');
												_isLogin = false;
												alert(text.split(",")[1]);
											}else{
												_isLogin = false;
												alert(text.split(",")[1]);
											}
										}
									});
	}
	_alert.Hidden();
	return _isLogin;
}
